#include <iostream>
using std::cout;
using std::endl;

#define ShowMsg(msg)                                                    \
  std::cout << __func__ << " " << __LINE__ << " " << #msg << ":" << msg \
            << std::endl;
#define ShowMsg1(msg) ShowMsg(msg);
#define ShowMsg2(msg1, msg2)                                                   \
  std::cout << __func__ << " line:" << __LINE__ << " " << #msg1 << ":" << msg1 \
            << " " << #msg2 << ":" << msg2 << std::endl;
#define ShowMsg3(msg1, msg2, msg3)                                             \
  std::cout << __func__ << " line:" << __LINE__ << " " << #msg1 << ":" << msg1 \
            << " " << #msg2 << ":" << msg2 << " " << #msg3 << ":" << msg3      \
            << std::endl;
#define ShowMsg4(msg1, msg2, msg3, msg4)                                       \
  std::cout << __func__ << " line:" << __LINE__ << " " << #msg1 << ":" << msg1 \
            << " " << #msg2 << ":" << msg2 << " " << #msg3 << ":" << msg3      \
            << " " << #msg4 << ":" << msg4 << std::endl;
#define ShowMsg5(msg1, msg2, msg3, msg4, msg5)                                 \
  std::cout << __func__ << " line:" << __LINE__ << " " << #msg1 << ":" << msg1 \
            << " " << #msg2 << ":" << msg2 << " " << #msg3 << ":" << msg3      \
            << " " << #msg4 << ":" << msg4 << " " << #msg5 << ":" << msg5      \
            << std::endl;
#define ShowVec1d(vec)                                                         \
  std::cout << __func__ << " line:" << __LINE__ << " " << #vec << ":" << endl; \
  for (auto i : vec) {                                                         \
    cout << i << " ";                                                          \
  }                                                                            \
  cout << endl;
#define ShowVec1dMatlab(vec) \
  std::cout << #vec << "=["; \
  for (auto i : vec) {       \
    cout << i << ",";        \
  }                          \
  cout << "];" << endl;
#define ShowVec1dVecFormat(vec) \
  std::cout << #vec << "={";    \
  for (auto i : vec) {          \
    cout << i << ",";           \
  }                             \
  cout << "};" << endl;
#define ShowVec2d(vec)                                                         \
  std::cout << __func__ << " line:" << __LINE__ << " " << #vec << ":" << endl; \
  for (auto i : vec) {                                                         \
    for (auto j : i) {                                                         \
      cout << j << " ";                                                        \
    }                                                                          \
    cout << endl;                                                              \
  }                                                                            \
  cout << endl;
#define ShowVec2dMatlab(vec) \
  std::cout << #vec << "=["; \
  for (auto i : vec) {       \
    for (auto j : i) {       \
      cout << j << ",";      \
    }                        \
    cout << ";";             \
  }                          \
  cout << "];" << endl;
#define ShowVec2dVecformat(vec) \
  std::cout << #vec << "={";    \
  for (auto i : vec) {          \
    std::cout << "{";           \
    for (auto j : i) {          \
      cout << j << ",";         \
    }                           \
    cout << "},";               \
  }                             \
  cout << "};" << endl;
#define ShowArray2d(vec, m, n)                                                 \
  std::cout << __func__ << " line:" << __LINE__ << " " << #vec << ":" << endl; \
  for (int i = 0; i < m; ++i) {                                                \
    for (int j = 0; j < n; ++j) {                                              \
      cout << vec[i][j] << " ";                                                \
    }                                                                          \
    cout << endl;                                                              \
  }                                                                            \
  cout << endl;

#define ShowMsgs(count, ...) ShowMsg##count(__VA_ARGS__);
#define locate cout << __FILE__ << " " << __func__ << " " << __LINE__ << endl;
